<%--
  Created by IntelliJ IDEA.
  User: 倪继文
  Date: 2016/11/4
  Time: 9:18
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>

    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="${ctx}/static/css/base.css" />
    <link rel="stylesheet" href="${ctx}/static/js/bootstrap-3.3.5/css/bootstrap.min.css" />
    <link rel="stylesheet" href="${ctx}/static/css/my-stlye.css" />

    <link rel="stylesheet" type="text/css" href="${ctx}/static/js/jquery-easyui-1.5/themes/icon.css">
    <link rel="stylesheet" href="${ctx}/static/css/etl.css" />
    <link rel="stylesheet" href="${ctx}/static/layui/css/layui.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/static/js/jquery-easyui-1.5/themes/default/easyui.css">
    <style>
        .searchspan{
            display: inline-block;width:70px;padding-left: 3px
        }
    </style>


</head>
<body>
<script type="text/javascript" src="${ctx}/static/js/jquery-1.11.2.min.js" ></script>
<script type="text/javascript" src="${ctx}/static/layui/layui.all.js"></script>

<script type="text/javascript" src="${ctx}/static/js/dlcommon.js?v=3"></script>
<script type="text/javascript" src="${ctx}/static/js/bootstrap-3.3.5/bootstrap.min.js" ></script>
<script type="text/javascript" src="${ctx}/static/js/jquery-easyui-1.5/jquery.easyui.min.js" ></script>
<script type="text/javascript" src="${ctx}/static/js/jquery-easyui-1.5/locale/easyui-lang-zh_CN.js"></script>
<div class=" inter-content">
    <div class=" form-inline"  style="padding:0 5px;height:40px; padding-top: 5px; border-bottom: 1px dotted #ddd;margin-bottom: 10px;">



            <label class="searchspan" style="width:50px;" >院区 </label>
            <select style="width:150px;height: 24px; line-height: 24px;padding:0px" onchange="changeMethod()" name="" id="selhospital" class="form-control">
            </select>

            <span class="searchspan" >监测批次:</span>
            <select id="selpackmain" onchange="bindHistory()" class=" easyui-combogrid" name="dept" style="width:250px;"></select>
            <span class="searchspan">批次版本:</span>
            <select id="selhistory" class="easyui-combogrid" name="dept" style="width:250px;"></select>

            <div class="btn-group "  role="group">
                <button type="button" class="btn btn-default bi-btn-width90" onclick="search()">查询</button>
            </div>

    </div>
</div>
<iframe id="rptFrame" runat="server" scrolling="no" frameborder="0" src="" width="100%" height="100%"></iframe>
<script>
    var planid="";
    $(function () {
        var height = findDimensions_height();
        var width = findDimensions_width();
        $("#rptFrame").height(height-50);
        bindSearch();
    })
    function search(){
        var url="${rptSRC}";
        var sel=$("#selhistory").combogrid("grid").datagrid("getSelected");
        if(!sel)
        {
            dLong.layerInfo("请选择版本批次");
            return;
        }
        // url+= '&bivar='+sel.id+'&cxtj=&topdata=&timew=&weiplan=';
        url+= '&ispage=false&&bivar=10093&cxtj=&topdata=&timew=&weiplan=';
        $("#rptFrame").attr("src",url);
    }
    //绑定sql条件
    function bindSearch(){
        //绑定批次
        $('#selpackmain').combogrid({
            panelWidth:250,
            panelHeight:300,
            idField:'id',
            textField:'name',
            columns:[[
                {field:'name',title:'请选择',width:240,align:'left',halign: 'center'}
            ]], onSelect : function(index, row){
                bindHistory();
            }
        })

//        //绑定批次
        $('#selhistory').combogrid({
            panelWidth:250,
            panelHeight:300,
            idField:'id',
            textField:'name',

            columns:[[
                {field:'name',title:'请选择',width:240,align:'left',halign: 'center'}
            ]]
        })

        bindSelect();

    }
    function bindSelect(){
        var postdata = {p_dm: "V_ZkptDataPacketHistoryList_GetAllPlan"};
        dLong.getJSON("/commapiV2",postdata,function(data){
            var s="";
            $("#selhospital").html("");
            $.each(data.Table,function(i,item){
                s+='<option data-yqid="'+item.yqid+'" value="'+item.id+'">'+item.name+'</option>';
            })
            $(s).appendTo("#selhospital");
            changeMethod();
            bindPacket();

        });
    }
    function bindPacket(){
        var postdata = {p_dm: "V_ZkptAuditStatisticsDataList_GetPackList",planid:planid};
        dLong.getJSON("/commapiV2",postdata,function(data){
            if (data.success) {
                //var griddata = dLong.getGridData(data.Table,data.pagecount);

                $('#selpackmain').combogrid("grid").datagrid("loadData", data.Table);
                $('#selpackmain').combogrid("grid").datagrid("selectRow",0);

            }
        },true);
    }
    function changeMethod(){
        planid= $("#selhospital").val();
        bindPacket();
    }
    function bindHistory(){
        //绑定批次
        if(!$("#selpackmain").combogrid("grid").datagrid("getSelected"))
        {
            return ;
        }


        var postdata = {p_dm: "V_ZkptAuditStatisticsDataList_GetHistoryListByPack",Mid:$("#selpackmain").combogrid("grid").datagrid("getSelected").id};
        dLong.getJSON("/commapiV2",postdata,function(data){
            if (data.success) {
                //var griddata = dLong.getGridData(data.Table,data.pagecount);

                $('#selhistory').combogrid("grid").datagrid("loadData", data.Table);
                $('#selhistory').combogrid("grid").datagrid("selectRow",0);
            }
        },true);
    }


    function findDimensions_width() //函数：获取尺寸
    {
        var winwidth = 0;
        //获取窗口宽度
        if (window.innerWidth)
            winwidth = window.innerWidth;
        else if ((document.body) && (document.body.clientWidth))
            winwidth = document.body.clientWidth;

        //通过深入Document内部对body进行检测，获取窗口大小
        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
            winwidth = document.documentElement.clientWidth;
        }
        return winwidth;
    }

    function findDimensions_height() //函数：获取尺寸
    {
        //获取窗口宽度
        var winheight = 0;

        //获取窗口高度
        if (window.innerHeight)
            winheight = window.innerHeight;
        else if ((document.body) && (document.body.clientHeight))
            winheight = document.body.clientHeight;
        //通过深入Document内部对body进行检测，获取窗口大小
        if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) {
            winheight = document.documentElement.clientHeight;
        }
        return winheight;
    }
</script>
</body>
</html>
